-
Notifications
You must be signed in to change notification settings - Fork 8.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Cases] Custom Fields as Cases Filters #171176
[Cases] Custom Fields as Cases Filters #171176
Conversation
…ger/kibana into issue-167651-custom-fields-as-filters
…67651-custom-fields-as-filters
…om-fields-as-filters
…ger/kibana into issue-167651-custom-fields-as-filters
@@ -129,7 +129,7 @@ export interface AppMockRenderer { | |||
render: UiRender; | |||
coreStart: StartServices; | |||
queryClient: QueryClient; | |||
AppWrapper: React.FC<{ children: React.ReactElement }>; | |||
AppWrapper: React.FC<{ children: React.ReactNode }>; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I got an ts error here https://github.com/elastic/kibana/pull/171176/files#diff-5ce927c2e523c85bb1853fd933c3469c1881f69eef57ff75be97e622b18621a0R54. Looks like changing this does not break anything
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems fine to me. Unrelated to the type change, what about wrapper: appMockRender.AppWrapper
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tried but it returns another ts error
Type 'FC<{ children: ReactNode; }>' is not assignable to type 'WrapperComponent<{ systemFilterConfig: FilterConfig[]; onFilterOptionChange: FilterChangeHandler; }> | undefined'.
Any idea what it means?
@@ -161,4 +161,23 @@ describe('multi select filter', () => { | |||
await waitForEuiPopoverOpen(); | |||
expect(screen.getAllByTestId(TEST_ID).length).toBe(2); | |||
}); | |||
|
|||
it('should not show the amount of options if hideActiveOptionsNumber is active', () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
new feature as the "more" button doesn't seem to be showing this info
query: { | ||
...DEFAULT_QUERY_PARAMS, | ||
expect(fetchMock).toHaveBeenCalledWith(`${CASES_INTERNAL_URL}/_search`, { | ||
method: 'POST', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
migration from _find to _search using post and body as string
@@ -257,4 +309,459 @@ describe('CasesTableFilters ', () => { | |||
expect(onCreateCasePressed).toHaveBeenCalledWith(); | |||
}); | |||
}); | |||
|
|||
describe('toggle type custom field filter', () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Most of the tests for this feature are here. This way we test the whole integration with the table
Pinging @elastic/response-ops (Team:ResponseOps) |
Pinging @elastic/response-ops-cases (Feature:Cases) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great code! I really liked the architecture and how clean it is. Some comments:
- If you add two custom fields, filter both of them by some value, delete them in another tab, and then switch to the tab where you filtered you will see this error:
Probably because two API calls are happening and the first one contains the second custom field
- I was playing around with creating multiple custom fields and deleting them and I managed to produce this bug. I don't know how. I cannot reproduce it 🙂
- I think we should remove the +more button from the modal. Wdyt?
- When I search for
In progress
it does not show. I guess we are searching in the keys, right?
@@ -129,7 +129,7 @@ export interface AppMockRenderer { | |||
render: UiRender; | |||
coreStart: StartServices; | |||
queryClient: QueryClient; | |||
AppWrapper: React.FC<{ children: React.ReactElement }>; | |||
AppWrapper: React.FC<{ children: React.ReactNode }>; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems fine to me. Unrelated to the type change, what about wrapper: appMockRender.AppWrapper
?
x-pack/plugins/cases/public/components/all_cases/severity_filter.test.tsx
Show resolved
Hide resolved
...ns/cases/public/components/all_cases/table_filter_config/use_custom_fields_filter_config.tsx
Outdated
Show resolved
Hide resolved
x-pack/plugins/cases/public/components/custom_fields/translations.ts
Outdated
Show resolved
Hide resolved
x-pack/plugins/cases/public/components/all_cases/table_filter_config/use_filter_config.tsx
Show resolved
Hide resolved
x-pack/plugins/cases/public/components/all_cases/table_filter_config/use_filter_config.tsx
Outdated
Show resolved
Hide resolved
x-pack/plugins/cases/public/components/all_cases/table_filters.tsx
Outdated
Show resolved
Hide resolved
...ns/cases/public/components/all_cases/table_filter_config/use_custom_fields_filter_config.tsx
Show resolved
Hide resolved
...ns/cases/public/components/all_cases/table_filter_config/use_custom_fields_filter_config.tsx
Show resolved
Hide resolved
x-pack/plugins/cases/public/components/all_cases/table_filter_config/use_filter_config.tsx
Show resolved
Hide resolved
x-pack/plugins/cases/public/components/all_cases/table_filter_config/use_filter_config.tsx
Show resolved
Hide resolved
|
💔 Build FailedFailed CI StepsMetrics [docs]
History
To update your PR or re-run it, just comment with: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tested and all the issues are fixed now 🚀. Code LGTM. Thanks for addressing our feedback. I found the following small issues. We can fix them on another PR:
- The search payload contains empty custom fields. I think is better if we omit the empty object.
- Every time you delete 2+ custom fields two calls are being made with the one failing but no toaster is shown (probably due to the call being canceled immediately). I think you mentioned the same in our meeting.
…lds (#172276) Meta issue #167651 Fixes: #167651 ## Summary Previous PRs merged into this feature branch: - #169356 - #169371 - #170851 - #171102 - #171176 ## Release notes Case list filter bar can now be customised. Filters can be removed and custom fields can be used as filters ## Pending issues - Table in modal shouldn’t load in local storage saved filter options of status/severity - Status & Severity filters in url. Filters must be activated if the user has them deactivated - UI overflow when to much filters are active - Race condition: When a user has a custom field active with an option selected and this custom field gets removed in settings, it includes the removed custom field when refreshing. This request will fail, triggering a second one which won't include the removed custom field - Found during QA. In the modal, when trying to select all options in the solutions filter, when checking the last unchecked option, it resets and there is no checked option anymore ## Flaky test runner link https://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/4128 --------- Co-authored-by: Antonio <[email protected]> Co-authored-by: kibanamachine <[email protected]>
Meta issue: #167651
Summary
Screenshot.mov
What this PR does not include (will be done in future PRs)
useEffect situation
We tried to remove some useEffects, specifically in useFilterConfig and useSystemFilterConfig but as they have dependencies that are loaded from API's, there are some use cases, like if a new custom field is added or removed where effects (I think) are a must. We will come back to this issue once we have the feature in main to try to solve this issue